<?php
$con=mysql_connect('127.0.0.1','root','');
$db=mysql_selectdb('proc',$con);
function add_task($cmd,$params,$callback){
	global $db;
	mysql_query(sprintf("insert into cmd (func,params,callback) values('%s','%s','%s')",$cmd,json_encode($params),$callback));
}

function remove_task($task_id){
	global $db;
}

$tasks=array(array('func'=>'pp','params'=>array(1,2,3),'callback'=>'callback'),
			 array('func'=>'pp','params'=>array(4,2,3),'callback'=>'callback'),
			 array('func'=>'pp','params'=>array(5,2,3),'callback'=>'callback'));
$i=2;
while($i-->0){
	foreach($tasks as $t){
		add_task($t['func'],$t['params'],$t['callback']);
	}	
}




?>